<template>
	<view>
		<view class="err_div">
			<view class="center_div">
				<view>{{resultParam.accuracy}}</view>
				<view>正确度</view>
			</view>
			
		</view>
		
		<view class="fenxi_div">
			<view class="fenxi_title">本次答题 {{resultParam.rightNum}}/{{resultParam.answerNum }}</view>
			<view class="fenxi_bottom">
				<view class="bottom_item">
					<view>总数</view>
					<view>{{resultParam.answerNum }}</view>
				</view>
				<view class="bottom_item">
					<view>答对</view>
					<view>{{resultParam.rightNum}}</view>
				</view>
				<view class="bottom_item">
					<view>答错</view>
					<view>{{resultParam.wrongNum}}</view>
				</view>
			</view>
		</view>
		
		<view class="btn_div" @click="lookAnalysis">
			查看解析
		</view>
	</view>
</template>

<script>
	export default{
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.targetId = option.targetId;//接受考试Id
			this.type = option.type;//接受考试Id
			console.log(option);
		},
		data(){
			return{
				targetId:0,
				type:0,
				resultParam:'',
			}
		},
		onReady: function() {
			uni.request({
				url: this.baseUrl+'getPracticeResult',
				method: 'POST',
				data: { 
					'targetId':this.targetId,//章节id
					'stuId':uni.getStorageSync('uid'),//学生id
					'type':this.type
				},
				header: {
					'content-type': 'application/x-www-form-urlencoded'
				},
				success: (res) => {
					console.log(res);  
					this.resultParam=res.data.practiceResultVO;
					
					
				}
			});
			
		},
		
		methods:{
			lookAnalysis:function(){
				//查看解析
				uni.navigateTo({
					url:'../examAnalysis/examAnalysis?id='+this.targetId+'&type='+this.type
				})
			}
		}
	}
</script>

<style>
	.err_div{
		height: 386rpx;
		background: url(../../static/errorlist_bg.png);
		background-size: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 20rpx;
		flex-direction: column;
	}
	.err_div .center_div{
		width: 240rpx;
		height: 240rpx;
		background: url(../../static/errorlist_icon.png);
		background-size: 100%;
		display: flex;
	    justify-content: center;
		align-items: center;
		flex-direction: column;
	}
	.err_div .center_div view:nth-child(1){
		color: #FFFFFF;
		text-align: center;
		font-size: 60rpx;
	}
	.err_div .center_div view:nth-child(2){
		color: #FFFFFF;
		text-align: center;
		font-size: 24rpx;
		margin-top: 20rpx;
	}
	.fenxi_div {
		background: #FFFFFF;
		margin-left: 20rpx;
		margin-right: 20rpx;
		border-radius: 10rpx;
		padding-left: 20rpx;
		padding-right: 20rpx;
		padding-top: 28rpx;
		margin-top: 20rpx;
		padding-bottom: 30rpx;
	}
	
	.fenxi_div .fenxi_title {
	
		font-size: 30rpx;
		color: #333333;
	}
	
	.fenxi_div .fenxi_bottom {
		display: flex;
	}
	
	.fenxi_div .fenxi_bottom .bottom_item {
		flex: 1;
		text-align: center;
	}
	
	.fenxi_div .fenxi_bottom .bottom_item view:nth-child(1) {
		height: 36rpx;
		width: 90rpx;
		display: inline-block;
		background: #b2b2b2;
		color: #FFFFFF;
		text-align: center;
		line-height: 36rpx;
		font-size: 24rpx;
		margin-top: 30rpx;
		border-radius: 18rpx;
	
	}
	
	.fenxi_div .fenxi_bottom .bottom_item view:nth-child(2) {
		margin-top: 40rpx;
		font-size: 24rpx;
		color: #333333;
	
	}
	.btn_div{
		height: 70rpx;
		margin-top: 40rpx;
		margin-left: 40rpx;
		margin-right: 40rpx;
		background: #e13b29;
		margin-bottom: 40rpx;
		border-radius: 10rpx;
		color: #FFFFFF;
		font-size: 24rpx;
		text-align: center;
		line-height: 70rpx;
	}
</style>
